Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass custom styles to the WebView container #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ export default App
| callback | False | A function that you want the SDK to callback to upon closing of the SDK (whether successful or failed) |
| version | False | Which version of the LinkSDK you want to load (defaults to @latest) |
| sandbox | False | Whether the LinkSDK is in sandbox or not (defaults to `False`) |
| containerStyle | False | Custom styles passed to the opened container |
| containerClosedStyle | False | Custom styles passed to the closed container |


## Methods
Expand Down
9 changes: 7 additions & 2 deletions src/components/LinkSDK/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,12 @@ const LinkSDK = forwardRef((props, ref) => {
}
}

const openedContainerStyle = [styles.container, props.containerStyle];
const closedContainerStyle = [styles.containerClosed, props.containerClosedStyle];

return (
<View
style={isOpen ? styles.container : styles.containerClosed}
style={isOpen ? openedContainerStyle : closedContainerStyle}
height={Dimensions.get('window').height}
width={Dimensions.get('window').width}
>
Expand Down Expand Up @@ -209,7 +212,9 @@ const LinkSDK = forwardRef((props, ref) => {
})

LinkSDK.defaultProps = {
webViewProps: {}
webViewProps: {},
containerStyle: {},
containerClosedStyle: {}
}

const styles = StyleSheet.create({
Expand Down