NativeBase icon indicating copy to clipboard operation
NativeBase copied to clipboard

Checkbox text overflows out of container

Open darrenkeen opened this issue 2 years ago • 5 comments

Description

When using the Checkbox component, having some long text results in content going off the screen or out of the containers width.

CodeSandbox/Snack link

https://snack.expo.dev/K6hps6IFF

Steps to reproduce

Expo: 44.0.6 Native Base: 3.4.11 React: 17.0.1 React Native: 0.64.3

import { Box, Checkbox, NativeBaseProvider } from 'native-base';

export default function App() {
  return (
    <NativeBaseProvider>
      <Box>
        <Checkbox isInvalid value="invalid" mt={10}>
          This is a long bit of text inorder to go out of this page and see the
          issue
        </Checkbox>
      </Box>
    </NativeBaseProvider>
  );
}

I took a basic expo app to show this problem Screenshot 2022-08-10 at 22 56 34

NativeBase Version

3.4.11

Platform

  • [X] Android
  • [ ] CRA
  • [X] Expo
  • [X] iOS
  • [ ] Next

Other Platform

No response

Additional Information

No response

darrenkeen avatar Aug 10 '22 22:08 darrenkeen

Hi @darrenkeen, Thanks for reporting the issue. we will look into it.

Viraj-10 avatar Aug 23 '22 12:08 Viraj-10

I have a different problem with a long text. The checkbox icon take all height of the screen.

image

To resolve it, I add the style below :

return (
    <Checkbox value={'one'} _text={{ width: '100%', flex: 1 }} width={'100%'}>
      This is a long bit of text inorder to go out of this page and see the issue
    </Checkbox>
)

HyperNovax avatar Sep 02 '22 11:09 HyperNovax

Hey, You can try this code 👇

import { Box, Checkbox, NativeBaseProvider, Text } from 'native-base';

export default function App() {
  return (
    <NativeBaseProvider>
      <Box>
        <Checkbox isInvalid value="invalid" mt={10}>
         <Text style={{flex: 1, flexWrap: 'wrap'}}>  This is a long bit of text inorder to go out of this page and see the issue
   </Text>
        </Checkbox>
      </Box>
    </NativeBaseProvider>
  );
}

sahilvasuja avatar Dec 14 '22 09:12 sahilvasuja

Hi This also works:

<HStack space={1} >
    <Text bold>Descripción:</Text>
    <Text flex flexWrap="wrap" >{pet.description}</Text>
</HStack>

dhcmega avatar Feb 26 '24 13:02 dhcmega

@dhcmega in Text component I think it should be flex={1} instead of only flex.

gabrielpdsilva avatar Jun 12 '24 14:06 gabrielpdsilva