react-native-masked-view / masked-view

React Native Masked View Library
MIT License
952 stars 114 forks source link

Dynamic height based on content #141

Open tslater opened 2 years ago

tslater commented 2 years ago

All of the examples show heights expanding to fill containers. Is there any way to have the masked view expand/contract based on the size of text content?

fukemy commented 2 years ago

hi, did u solved this? The biggest problem of maskview is's requiring height for below component

mym0404 commented 1 year ago

Render maskElement at children too. If you need, you have to hide and ignore touch event with opacity or pointerEvents

    <MaskedView maskElement={<>{children}</>} {...viewProps}>
      {/* layout purpose */}
      <View style={{ opacity: 0 }} pointerEvents={'none'}>
        {children}
      </View>
      <LinearGradient.../>
    </MaskedView>
DmitrijPerejro commented 1 year ago

nice

fukemy commented 1 year ago

Render maskElement at children too. If you need, you have to hide and ignore touch event with opacity or pointerEvents

    <MaskedView maskElement={<>{children}</>} {...viewProps}>
      {/* layout purpose */}
      <View style={{ opacity: 0 }} pointerEvents={'none'}>
        {children}
      </View>
      <LinearGradient.../>
    </MaskedView>

I think I will took more performance

mym0404 commented 1 year ago

sure, so I use this only icon and texts.

daeltondias commented 4 months ago

Render maskElement at children too. If you need, you have to hide and ignore touch event with opacity or pointerEvents

    <MaskedView maskElement={<>{children}</>} {...viewProps}>
      {/* layout purpose */}
      <View style={{ opacity: 0 }} pointerEvents={'none'}>
        {children}
      </View>
      <LinearGradient.../>
    </MaskedView>

This really works for me! Thanks!