Last active
October 2, 2017 12:31
-
-
Save mateoKaradza/38473ec173484c584e8fe3bc1bfb12b8 to your computer and use it in GitHub Desktop.
Index.js of a ScrollView component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { ScrollView, Platform } from 'react-native' | |
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view' | |
export default function ({ children, style, contentContainerStyle, extraScrollHeight }) { | |
if (Platform.OS === 'ios') { | |
return ( | |
<ScrollView | |
style={style} | |
contentContainerStyle={contentContainerStyle} | |
> | |
{children} | |
</ScrollView> | |
) | |
} | |
return ( | |
<KeyboardAwareScrollView | |
style={style} | |
contentContainerStyle={contentContainerStyle} | |
extraScrollHeight={extraScrollHeight || 0} | |
> | |
{children} | |
</KeyboardAwareScrollView> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment