mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-03-29 00:18:20 +08:00
Add @expo/vector-icons definitions (#23093)
* Add @expo/vector-icons definitions * Rename the test file
This commit is contained in:
111
types/expo__vector-icons/expo__vector-icons-tests.tsx
Normal file
111
types/expo__vector-icons/expo__vector-icons-tests.tsx
Normal file
@@ -0,0 +1,111 @@
|
||||
import * as React from 'react';
|
||||
import { View, Text, TabBarIOS } from 'react-native';
|
||||
import { createIconSet, MaterialIcons, FontAwesome, Ionicons } from 'expo__vector-icons';
|
||||
|
||||
const glyphMap = {
|
||||
custom: 58918
|
||||
};
|
||||
|
||||
const CustomIcon = createIconSet(glyphMap, 'FontCustom', 'FontCustom.ttf');
|
||||
|
||||
const CustomIconButton = CustomIcon.Button;
|
||||
const CustomIconTabBarItem = CustomIcon.TabBarItem;
|
||||
const CustomIconTabBarItemIOS = CustomIcon.TabBarItemIOS;
|
||||
const CustomIconToolbarAndroid = CustomIcon.ToolbarAndroid;
|
||||
const CustomIcongetImageSource = CustomIcon.getImageSource;
|
||||
|
||||
class Example extends React.Component {
|
||||
handleButton() {
|
||||
console.log('You pressed me');
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View>
|
||||
{/* Normal Icon */}
|
||||
<MaterialIcons size={30} color="red" name="exit" />
|
||||
|
||||
{/* Icon button */}
|
||||
<FontAwesome.Button
|
||||
backgroundColor="#3b5998"
|
||||
name="facebook"
|
||||
onPress={() => this.handleButton()}
|
||||
>
|
||||
<Text style={{ fontFamily: 'Arial', fontSize: 15 }}>
|
||||
Login with Facebook
|
||||
</Text>
|
||||
</FontAwesome.Button>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class TabTest extends React.Component<{}, { selectedTab: string }> {
|
||||
constructor() {
|
||||
super({});
|
||||
|
||||
this.state = {
|
||||
selectedTab: 'tab1'
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<TabBarIOS barTintColor="white">
|
||||
<Ionicons.TabBarItemIOS
|
||||
title="Tab1"
|
||||
iconName="ios-keypad-outline"
|
||||
selectedIconName="ios-keypad"
|
||||
selectedIconColor="pink"
|
||||
renderAsOriginal
|
||||
selected={this.state.selectedTab === 'tab1'}
|
||||
onPress={() => this.setState({ selectedTab: 'tab1' })}
|
||||
>
|
||||
<View />
|
||||
</Ionicons.TabBarItemIOS>
|
||||
|
||||
<Ionicons.TabBarItemIOS
|
||||
title="Tab2"
|
||||
iconName="ios-bookmark-outline"
|
||||
selectedIconName="ios-bookmark"
|
||||
selectedIconColor='pink'
|
||||
renderAsOriginal
|
||||
selected={this.state.selectedTab === 'tab2'}
|
||||
onPress={() => this.setState({ selectedTab: 'tab2' })}
|
||||
>
|
||||
<View />
|
||||
</Ionicons.TabBarItemIOS>
|
||||
</TabBarIOS>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class TestCustomIcon extends React.Component {
|
||||
constructor() {
|
||||
super({});
|
||||
}
|
||||
|
||||
handleButton() {
|
||||
console.log('You pressed me');
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View>
|
||||
{/* Custom Icon */}
|
||||
<CustomIcon size={30} color="blue" name="custom" />
|
||||
|
||||
{/* Custom Icon button */}
|
||||
<CustomIcon.Button
|
||||
backgroundColor="#3b5998"
|
||||
name="facebook"
|
||||
onPress={() => this.handleButton()}
|
||||
>
|
||||
<Text style={{ fontFamily: 'Arial', fontSize: 15 }}>
|
||||
Hello CustomIcon!
|
||||
</Text>
|
||||
</CustomIcon.Button>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
21
types/expo__vector-icons/index.d.ts
vendored
Normal file
21
types/expo__vector-icons/index.d.ts
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
// Type definitions for @expo/vector-icons 6.2
|
||||
// Project: https://github.com/expo/vector-icons
|
||||
// Definitions by: Hyeonsu Lee <https://github.com/incleaf>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as React from 'react';
|
||||
import { TextProperties } from 'react-native';
|
||||
|
||||
export { createIconSet, createIconSetFromFontello, createIconSetFromIcoMoon } from 'react-native-vector-icons';
|
||||
export { default as Entypo } from 'react-native-vector-icons/Entypo';
|
||||
export { default as EvilIcons } from 'react-native-vector-icons/EvilIcons';
|
||||
export { default as Feather } from 'react-native-vector-icons/Feather';
|
||||
export { default as FontAwesome } from 'react-native-vector-icons/FontAwesome';
|
||||
export { default as Foundation } from 'react-native-vector-icons/Foundation';
|
||||
export { default as Ionicons } from 'react-native-vector-icons/Ionicons';
|
||||
export { default as MaterialCommunityIcons } from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||
export { default as MaterialIcons } from 'react-native-vector-icons/MaterialIcons';
|
||||
export { default as Octicons } from 'react-native-vector-icons/Octicons';
|
||||
export { default as SimpleLineIcons } from 'react-native-vector-icons/SimpleLineIcons';
|
||||
export { default as Zocial } from 'react-native-vector-icons/Zocial';
|
||||
25
types/expo__vector-icons/tsconfig.json
Normal file
25
types/expo__vector-icons/tsconfig.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"dom",
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"expo__vector-icons-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
types/expo__vector-icons/tslint.json
Normal file
1
types/expo__vector-icons/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user