From 08c1132b4474c0516279dcc2dd3730e1d457dc5b Mon Sep 17 00:00:00 2001 From: Grzegorz Pawlik Date: Mon, 23 May 2022 11:17:16 +0200 Subject: [PATCH] Pass custom styles to the WebView container --- Readme.md | 2 ++ src/components/LinkSDK/index.js | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index 5cb5888..4332d1f 100644 --- a/Readme.md +++ b/Readme.md @@ -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 diff --git a/src/components/LinkSDK/index.js b/src/components/LinkSDK/index.js index 245ab72..517754e 100644 --- a/src/components/LinkSDK/index.js +++ b/src/components/LinkSDK/index.js @@ -179,9 +179,12 @@ const LinkSDK = forwardRef((props, ref) => { } } + const openedContainerStyle = [styles.container, props.containerStyle]; + const closedContainerStyle = [styles.containerClosed, props.containerClosedStyle]; + return ( @@ -209,7 +212,9 @@ const LinkSDK = forwardRef((props, ref) => { }) LinkSDK.defaultProps = { - webViewProps: {} + webViewProps: {}, + containerStyle: {}, + containerClosedStyle: {} } const styles = StyleSheet.create({