masked-view icon indicating copy to clipboard operation
masked-view copied to clipboard

Dynamic height based on content

Open tslater opened this issue 4 years ago • 6 comments

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?

tslater avatar Sep 23 '21 06:09 tslater

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

fukemy avatar May 31 '22 03:05 fukemy

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>

mym0404 avatar Oct 18 '22 03:10 mym0404

nice

DmitrijPerejro avatar Dec 02 '22 10:12 DmitrijPerejro

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

fukemy avatar Dec 02 '22 10:12 fukemy

sure, so I use this only icon and texts.

mym0404 avatar Dec 02 '22 17:12 mym0404

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!

daeltondias avatar Apr 04 '24 00:04 daeltondias