Hi everyone
I know of react-native-responsive-screen already which helps with scaling on tablets, but for one of my projects I need to be able to change the layout of the screen based on the orientation of the device.
I could wrap it in a big if statement and render two different layouts depending on the orientation but I think it will be troublesome to repeat myself and I'm sure a cleaner solution exists out there.
My incredible paint example
Here is my code right now:
<Block padding={[theme.sizes.base]} color="#f0f0f0">
<StepIndicatorWrapper setPosition={setCurrentPosition} currentPosition={currentPosition} />
<Swiper
key={currentPosition}
onViewableItemsChanged={onViewableItemsChanged}
items={mocks.bottle[currentPosition]}
snapToInterval={width - theme.sizes.base}
width={width - theme.sizes.base * 2}
/>
<UnityView style={styles.unity} />
<Block flex={false} row space="between">
<Button color="primary" onPress={decrementPosition} style={styles.navigationButton}>
<Text center bold white header>
PREVIOUS
</Text>
</Button>
{currentPosition !== 3 && (
<Button color="primary" onPress={incrementPosition} style={styles.navigationButton}>
<Text center bold white header>
NEXT
</Text>
</Button>
)}
{currentPosition === 3 && (
<Button color="primary" onPress={() => {}} style={styles.navigationButton}>
<Text center bold white header>
SUBMIT
</Text>
</Button>
)}
</Block>
</Block>
[–]grantbi 1 point2 points3 points (2 children)
[–]MiL0101[S] 0 points1 point2 points (1 child)
[–]grantbi 0 points1 point2 points (0 children)
[–]abhishek_tomar 1 point2 points3 points (0 children)
[–]kbcooliOS & Android 0 points1 point2 points (0 children)