diff --git a/example/App.js b/example/App.js index b4fdba0..4f6ddfd 100644 --- a/example/App.js +++ b/example/App.js @@ -1,6 +1,29 @@ import React, { useState } from "react"; import { StatusBar, SafeAreaView } from "react-native"; -import WhatsNew from "./lib/src/WhatsNewKit"; +import WhatsNew from "react-native-whatsnew-kit"; + +const staticData = [ + { + title: "Awesome", + description: + "Suspendisse ex mauris, viverra vitae mi eget, consectetur interdum sem. Phasellus sodales elit ac mauris posuere", + icon: require("./assets/check.png"), + iconComponent: null + }, + { + title: "Dark Theme", + description: + "Orci varius. Aliquam accumsan lectus lorem, a congue diam commodo sit amet. Fusce laoreet sapien non lectus dignissim viverra.", + icon: require("./assets/theme.png"), + iconComponent: null + }, + { + title: "Bug Fixes", + description: "Donec non mauris sagittis, gravida velit vel, varius quam.", + icon: require("./assets/wiping.png"), + iconComponent: null + } +]; const App = () => { const [isVisible, setIsVisible] = useState(true); @@ -9,6 +32,7 @@ const App = () => { setIsVisible(false)} diff --git a/example/lib/src/WhatsNewKit.js b/example/lib/src/WhatsNewKit.js deleted file mode 100644 index 8238d76..0000000 --- a/example/lib/src/WhatsNewKit.js +++ /dev/null @@ -1,199 +0,0 @@ -import React from "react"; -import PropTypes from "prop-types"; -import { - Text, - View, - FlatList, - SafeAreaView, - Image, - TouchableOpacity -} from "react-native"; -import Modal from "react-native-modal"; -import styles, { - _iconStyle, - _container, - _buttonStyle, - _titleTextStyle, - _buttonTextStyle, - _textButtonTextStyle -} from "./WhatsNewKit.style"; - -const staticData = [ - { - title: "Awesome", - description: - "Suspendisse ex mauris, viverra vitae mi eget, consectetur interdum sem. Phasellus sodales elit ac mauris posuere", - icon: require("../../assets/check.png"), - iconComponent: null - }, - { - title: "Dark Theme", - description: - "Orci varius. Aliquam accumsan lectus lorem, a congue diam commodo sit amet. Fusce laoreet sapien non lectus dignissim viverra.", - icon: require("../../assets/theme.png"), - iconComponent: null - }, - { - title: "Bug Fixes", - description: "Donec non mauris sagittis, gravida velit vel, varius quam.", - icon: require("../../assets/wiping.png"), - iconComponent: null - } -]; - -const WhatsNewKit = props => { - const { - data, - width, - title, - height, - onPress, - isVisible, - iconWidth, - iconHeight, - buttonText, - fullScreen, - buttonStyle, - titleFontSize, - buttonFontSize, - titleFontColor, - titleTextStyle, - ImageComponent, - buttonTextStyle, - backgroundColor, - buttonFontColor, - textButtonValue, - textButtonOnPress, - itemDescTextStyle, - itemTitleTextStyle, - textButtonTextStyle, - textButtonFontColor, - buttonBackgroundColor, - ...others - } = props; - - renderItem = data => { - const { item } = data; - const { title, description, iconComponent, icon } = item; - return ( - - - {iconComponent || ( - - )} - - - - {title} - - - {description} - - - - ); - }; - - renderTitleView = () => ( - - {title} - - ); - - renderList = () => ( - index.toString()} - {...props} - /> - ); - - renderFooterButtons = () => ( - - - - {textButtonValue} - - - - - {buttonText} - - - - ); - - return ( - - - - {renderTitleView()} - {renderList()} - {renderFooterButtons()} - - - - ); -}; - -WhatsNewKit.propTypes = { - data: PropTypes.array, - title: PropTypes.string, - fullScreen: PropTypes.bool, - buttonText: PropTypes.string, - titleFontSize: PropTypes.number, - titleFontColor: PropTypes.string, - buttonFontSize: PropTypes.number, - buttonFontColor: PropTypes.string, - textButtonValue: PropTypes.string, - textButtonFontColor: PropTypes.string, - buttonBackgroundColor: PropTypes.string -}; - -WhatsNewKit.defaultProps = { - iconWidth: 50, - iconHeight: 50, - data: staticData, - fullScreen: false, - titleFontSize: 32, - buttonFontSize: 16, - title: "WhatsNewKit", - ImageComponent: Image, - buttonText: "Awesome!", - titleFontColor: "#000", - buttonFontColor: "#fdfdfd", - backgroundColor: "#fdfdfd", - textButtonValue: "Read more", - textButtonFontColor: "#3da7d2", - buttonBackgroundColor: "#3da7d2" -}; - -export default WhatsNewKit; diff --git a/example/lib/src/WhatsNewKit.style.js b/example/lib/src/WhatsNewKit.style.js deleted file mode 100644 index 9cdebe6..0000000 --- a/example/lib/src/WhatsNewKit.style.js +++ /dev/null @@ -1,91 +0,0 @@ -import { Dimensions } from "react-native"; -const { width: ScreenWidth } = Dimensions.get("window"); - -export const _iconStyle = (height, width) => ({ - width, - height -}); - -export const _container = (height, width, backgroundColor, fullScreen) => ({ - width, - height, - backgroundColor, - borderRadius: 16, - alignItems: fullScreen ? "center" : null, - justifyContent: fullScreen ? "center" : null -}); - -export const _titleTextStyle = (fontSize, color) => ({ - color, - fontSize, - fontWeight: "700" -}); - -export const _textButtonTextStyle = color => ({ - color, - fontWeight: "500" -}); - -export const _buttonStyle = backgroundColor => ({ - height: 50, - marginTop: 8, - backgroundColor, - borderRadius: 8, - alignItems: "center", - justifyContent: "center", - width: ScreenWidth * 0.8 -}); - -export const _buttonTextStyle = (color, fontSize) => ({ - color, - fontSize, - fontWeight: "500" -}); - -export const _itemTitleTextStyle = () => ({ - fontSize: 18, - fontWeight: "500" -}); - -export default { - containerGlue: { - margin: 32, - alignItems: "center", - justifyContent: "center" - }, - listStyle: { - width: "100%" - }, - footerButtonsContainer: { - alignItems: "center", - justifyContent: "center" - }, - textButtonStyle: { - marginTop: 32 - }, - itemContainer: { - marginTop: 32, - flexDirection: "row", - alignItems: "center" - }, - iconContainer: { - marginRight: 16, - alignItems: "center", - justifyContent: "center" - }, - itemContextContainer: { - width: "80%", - flexDirection: "column" - }, - itemTitleTextStyle: { - fontSize: 18, - fontWeight: "500" - }, - itemDescTextStyle: { - marginTop: 5, - color: "#313232" - }, - fullScreenModalStyle: { - margin: 0 - } -}; diff --git a/lib/src/WhatsNewKit.js b/lib/src/WhatsNewKit.js index 8238d76..3e7a7e5 100644 --- a/lib/src/WhatsNewKit.js +++ b/lib/src/WhatsNewKit.js @@ -18,29 +18,6 @@ import styles, { _textButtonTextStyle } from "./WhatsNewKit.style"; -const staticData = [ - { - title: "Awesome", - description: - "Suspendisse ex mauris, viverra vitae mi eget, consectetur interdum sem. Phasellus sodales elit ac mauris posuere", - icon: require("../../assets/check.png"), - iconComponent: null - }, - { - title: "Dark Theme", - description: - "Orci varius. Aliquam accumsan lectus lorem, a congue diam commodo sit amet. Fusce laoreet sapien non lectus dignissim viverra.", - icon: require("../../assets/theme.png"), - iconComponent: null - }, - { - title: "Bug Fixes", - description: "Donec non mauris sagittis, gravida velit vel, varius quam.", - icon: require("../../assets/wiping.png"), - iconComponent: null - } -]; - const WhatsNewKit = props => { const { data, @@ -179,9 +156,9 @@ WhatsNewKit.propTypes = { }; WhatsNewKit.defaultProps = { + data: [], iconWidth: 50, iconHeight: 50, - data: staticData, fullScreen: false, titleFontSize: 32, buttonFontSize: 16, diff --git a/package.json b/package.json index cde68ac..0b707bd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-whatsnew-kit", - "version": "0.0.1", + "version": "0.0.2", "description": "Plug & Play, beautiful WhatsNewKit for React Native", "keywords": [ "FreakyCoder", @@ -19,6 +19,9 @@ "repository": "git@github.com:WrathChaos/react-native-whatsnew-kit.git", "author": "Kuray (FreakyCoder) ", "license": "MIT", + "dependencies": { + "react-native-modal": ">= 11.5.3" + }, "peerDependencies": { "react": ">= 16.x.x", "react-native": ">= 0.55.x",