diff --git a/types/react-native-app-intro-slider/index.d.ts b/types/react-native-app-intro-slider/index.d.ts new file mode 100644 index 0000000000..e759047236 --- /dev/null +++ b/types/react-native-app-intro-slider/index.d.ts @@ -0,0 +1,37 @@ +// Type definitions for react-native-app-intro-slider 3.0 +// Project: https://github.com/jacse/react-native-app-intro-slider +// Definitions by: Haseeb Majid +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.1 + +import * as React from 'react'; +import { ButtonProps, TextProps, ViewStyle } from 'react-native'; + +export interface AppIntroProps { + skipLabel?: string; + doneLabel?: string; + nextLabel?: string; + prevLabel?: string; + bottomButton?: boolean; + buttonStyle?: ButtonProps; + buttonTextStyle?: TextProps; + dotStyle?: ViewStyle; + activeDotStyle?: ViewStyle; + paginationStyle?: TextProps; + hidePagination?: boolean; + renderNextButton?: () => void; + renderPrevButton?: () => void; + renderDoneButton?: () => void; + renderSkipButton?: () => void; + renderItem?: (item: any) => React.ReactElement; + slides: any[]; + showSkipButton?: boolean; + showPrevButton?: boolean; + showNextButton?: boolean; + showDoneButton?: boolean; + onSlideChange?: (index: number, lastIndex: number) => void; + onDone?: () => void; + onSkip?: () => void; +} + +export default class AppIntroSlider extends React.Component {} diff --git a/types/react-native-app-intro-slider/react-native-app-intro-slider-tests.tsx b/types/react-native-app-intro-slider/react-native-app-intro-slider-tests.tsx new file mode 100644 index 0000000000..ae288479b7 --- /dev/null +++ b/types/react-native-app-intro-slider/react-native-app-intro-slider-tests.tsx @@ -0,0 +1,68 @@ +import * as React from 'react'; +import { Image, StyleSheet, Text, View } from 'react-native'; +import AppIntroSlider from 'react-native-app-intro-slider'; + +const slides = [ + { + key: 'somethun', + title: 'Title 1', + text: 'Description.\nSay something cool', + image: require('./assets/1.jpg'), + backgroundColor: '#59b2ab', + }, + { + key: 'somethun-dos', + title: 'Title 2', + text: 'Other cool stuff', + image: require('./assets/2.jpg'), + backgroundColor: '#febe29', + }, + { + key: 'somethun1', + title: 'Rocket guy', + text: "I'm already out of descriptions\n\nLorem ipsum bla bla bla", + image: require('./assets/3.jpg'), + backgroundColor: '#22bcb5', + }, +]; + +const styles = StyleSheet.create({ + mainContent: { + flex: 1, + alignItems: 'center', + justifyContent: 'space-around', + }, + image: { + width: 320, + height: 320, + }, + text: { + color: 'rgba(255, 255, 255, 0.8)', + backgroundColor: 'transparent', + textAlign: 'center', + paddingHorizontal: 16, + }, + title: { + fontSize: 22, + color: 'white', + backgroundColor: 'transparent', + textAlign: 'center', + marginBottom: 16, + }, +}); + +export default class App extends React.Component { + _renderItem = (item: any) => { + return ( + + {item.title} + + {item.text} + + ); + } + + render() { + return ; + } +} diff --git a/types/react-native-app-intro-slider/tsconfig.json b/types/react-native-app-intro-slider/tsconfig.json new file mode 100644 index 0000000000..aa77e367da --- /dev/null +++ b/types/react-native-app-intro-slider/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6", "es2017"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react-native" + }, + "files": [ + "index.d.ts", + "react-native-app-intro-slider-tests.tsx" + ] +} diff --git a/types/react-native-app-intro-slider/tslint.json b/types/react-native-app-intro-slider/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-app-intro-slider/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }