Skip to content

Commit 94c3c69

Browse files
committed
Fix screen and some errors
1 parent 89def2a commit 94c3c69

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

demo/src/screens/componentScreens/TabControllerScreen/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class TabControllerScreen extends Component<{}, State> {
3232
items: []
3333
};
3434

35-
this.setState({items: this.generateTabItems()});
35+
this.state.items = this.generateTabItems();
3636
}
3737

3838
generateTabItems = (fewItems = this.state.fewItems, centerSelected = this.state.centerSelected): TabBarItemProps[] => {

generatedTypes/components/tabController/TabBarItem.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export interface TabBarItemProps {
7979
}
8080
interface Props extends TabBarItemProps {
8181
index: number;
82-
targetPage: number;
82+
targetPage: any;
8383
state: State;
8484
currentPage: Animated.Adaptable<number>;
8585
onLayout: (layout: Partial<LayoutRectangle>, index: number) => void;

generatedTypes/incubator/TouchableOpacity.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ export declare type TouchableOpacityProps = {
3939
* Pass custom style
4040
*/
4141
style?: ViewProps['style'];
42-
ref?: any;
4342
onLayout?: (event: LayoutChangeEvent) => void;
4443
testID?: string;
4544
};

src/components/tabController/TabBar.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export interface TabBarProps {
125125
type ChildProps = React.ReactElement<TabBarItemProps>;
126126

127127
interface Props extends TabBarProps, BaseComponentInjectedProps, ForwardRefInjectedProps {
128-
children: ChildProps[] | ChildProps;
128+
children?: ChildProps[] | ChildProps;
129129
}
130130

131131
interface State {
@@ -402,6 +402,10 @@ class TabBar extends PureComponent<Props, State> {
402402
return this.tabBarItems;
403403
}
404404

405+
if (!this.children) {
406+
return;
407+
}
408+
405409
this.tabBarItems = React.Children.map(this.children, (child: Partial<ChildProps>, index: number) => {
406410
// @ts-ignore TODO: typescript - not sure if this can be easily solved
407411
return React.cloneElement(child, {
@@ -427,7 +431,6 @@ class TabBar extends PureComponent<Props, State> {
427431
renderCodeBlock = () => {
428432
const {currentPage, targetPage} = this.context;
429433
const {itemsWidths, itemsOffsets} = this.state;
430-
431434
const nodes = [];
432435

433436
nodes.push(
@@ -476,7 +479,7 @@ class TabBar extends PureComponent<Props, State> {
476479
<View
477480
style={[
478481
styles.tabBar,
479-
_.isUndefined(height) && {height},
482+
!_.isUndefined(height) && {height},
480483
{paddingHorizontal: this.centerOffset, backgroundColor}
481484
]}
482485
>

src/components/tabController/TabBarItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export interface TabBarItemProps {
104104

105105
interface Props extends TabBarItemProps {
106106
index: number;
107-
targetPage: number;
107+
targetPage: any; // TODO: typescript?
108108
state: State;
109109
currentPage: Animated.Adaptable<number>;
110110
onLayout: (layout: Partial<LayoutRectangle>, index: number) => void;

src/incubator/TouchableOpacity.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ export type TouchableOpacityProps = {
6464
* Pass custom style
6565
*/
6666
style?: ViewProps['style'];
67-
// TODO: get these from somewhere
68-
ref?: any;
6967
onLayout?: (event: LayoutChangeEvent) => void;
7068
testID?: string;
7169
};

0 commit comments

Comments
 (0)