Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add web stub for this package #70

Open
jarvisluong opened this issue Jul 11, 2020 · 4 comments
Open

Add web stub for this package #70

jarvisluong opened this issue Jul 11, 2020 · 4 comments

Comments

@jarvisluong
Copy link

Feature request

It would be nice to add a web stub implementation for this package based on react-native-web

Possible implementation

I haven't dived in much how the actual implementation can be, however, a stub based on normal <View /> could be suffice I suppose.

Code sample

export function MaskedViewWeb({ maskElement: _ /* Not used */, ...props }: MaskedViewProps) {
  return <View {...props} />;
}
@KingAmo
Copy link

KingAmo commented Jul 27, 2020

+1

i don't have the skill to help, but i also need this feature

@joseDaKing
Copy link

Implementation can be implemented with css clip path, because all browsers support css clip path with inline svg

@msvargas
Copy link

msvargas commented Jul 1, 2022

This works better for me:

import React from 'react';
import { View } from 'react-native';

function MaskedViewWeb({ maskElement, ...props }) {
	return React.createElement(View, props, maskElement);
}

export default MaskedViewWeb;

Naturalclar pushed a commit that referenced this issue Oct 16, 2022
Co-authored-by: Michel Couillard <mcouillard@hortau.com>
@Julia20011974
Copy link

Julia20011974 commented May 25, 2023

Hello, everyone, i just used css - inset-
important idea, you have 2 blocks,
first - back,
second - front,
they lie on top of each other, and when you just get value, that show part back, and hide front,
also important, they lie pixel by pixel, it for your text that your pixels don't brake

!!!!!!
it's using styled for web, i mean

import styled from 'styled-components',

not in

import styled from 'styled-components/native'

   const inset = `inset(0 0 0 ${val}%)`;
   const inlineStyles = {clipPath: inset, WebkitClipPath: inset};
          <Wrapper>
            <Back>
              Upload {val}%
            </Back>
            <Front style={inlineStyles}>
              Upload {val}%
            </Front>
          </Wrapper>
const Back = styled.div`
  background: red;
  color: white;
  width: 100%;
  height: 100%;
  align-items: center;
  display: flex;
  justify-content: center;
`;
const Front = styled.div`
  height: 50px;
  position: absolute;
  top: 0;
  text-align: center;
  width: 100%;
  background: white;
  color:  red;
  clip-path: inset(0 0 0 0);
  transition: clip-path 0.3s ease-in;
  align-items: center;
  display: flex;
  justify-content: center;
`;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants