Skip to content

Instantly share code, notes, and snippets.

@mateoKaradza
Last active October 2, 2017 12:31
Show Gist options
  • Save mateoKaradza/38473ec173484c584e8fe3bc1bfb12b8 to your computer and use it in GitHub Desktop.
Save mateoKaradza/38473ec173484c584e8fe3bc1bfb12b8 to your computer and use it in GitHub Desktop.
Index.js of a ScrollView component
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