GeekyAnts / NativeBase

Mobile-first, accessible components for React Native & Web to build consistent UI across Android, iOS and Web.
https://nativebase.io/
MIT License
20.19k stars 2.38k forks source link

Name is No Longer Optional Attribute for 'Icon' component in Typescript #2715

Closed wardjk87 closed 4 years ago

wardjk87 commented 5 years ago

I have gone through these following points

Issue Description

This fix (https://github.com/GeekyAnts/NativeBase/issues/960) has been removed in current version of index.d.ts for native base 2.12.1. Name is no longer optional. According to documentation Icon can be used without name but with android and ios properties.

Following is copy of documentation example of Icon:

`import React, { Component } from 'react'; import { Container, Header, Content, Icon } from 'native-base'; export default class IconExample extends Component { render() { return (

);

} }`

lines 642-653 of index.t.ts

interface Icon extends Testable { name: string; type?: "AntDesign" | "Entypo" | "EvilIcons" | "Feather" | "FontAwesome" | "FontAwesome5" | "Foundation" | "Ionicons" | "MaterialCommunityIcons" | "MaterialIcons" | "Octicons" | "SimpleLineIcons" | "Zocial"; // TODO position attribute of ReactNative.FlexStyle hasn't another position values without "absolute" and "relative" style?: any; onPress?: (e?: any) => any; active?: boolean; ios?: string; android?: string; color?: string; fontSize?: number; }

Example usage that triggers 'Property 'name' is missing in type...' error in Typescript: <Icon active ios='ios-send' android='md-send />

node, npm, react-native, react and native-base version, expo version if used, xcode version

irrelevant

Expected behaviour

Typescript does not complain about only using ios and android properties of Icon.

Actual behaviour

Typescript complains that attribute name is missing

Steps to reproduce

-use Typescript and Icon with only ios and android attributes without name defined

Is the bug present in both iOS and Android or in any one of them?

Irrelevant

Any other additional info which would help us debug the issue quicker.

wardjk87 commented 5 years ago

Has this been reviewed?

hanykumar commented 4 years ago

Hi @wardjk87 , Found no issue with Icon in Typescript with NativeBase v2.13.14 . Closing for now. Let us know if the issue still persists.

Screenshot 2020-09-01 at 12 09 20 PM