mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Added react-native-app-intro-slider (#37137)
* Added react-native-app-intro-slider Added react-native-app-intro-slider. * Fixed pipeline error Removed semicolon to fix pipeline error.
This commit is contained in:
parent
efa2c81aab
commit
cc53e7ccbe
37
types/react-native-app-intro-slider/index.d.ts
vendored
Normal file
37
types/react-native-app-intro-slider/index.d.ts
vendored
Normal file
@ -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 <https://github.com/hmajid2301>
|
||||
// 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<AppIntroProps> {}
|
||||
@ -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 (
|
||||
<View style={{ flex: 1 }}>
|
||||
<Text style={styles.title}>{item.title}</Text>
|
||||
<Image source={item.image} />
|
||||
<Text style={styles.text}>{item.text}</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
return <AppIntroSlider renderItem={this._renderItem} slides={slides} />;
|
||||
}
|
||||
}
|
||||
20
types/react-native-app-intro-slider/tsconfig.json
Normal file
20
types/react-native-app-intro-slider/tsconfig.json
Normal file
@ -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"
|
||||
]
|
||||
}
|
||||
1
types/react-native-app-intro-slider/tslint.json
Normal file
1
types/react-native-app-intro-slider/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user