-
-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from react-component/rm-mixin2
chore: rm mixin and react-create-class
- Loading branch information
Showing
23 changed files
with
681 additions
and
463 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,29 @@ | ||
import createReactClass from 'create-react-class'; | ||
import InkTabBarMixin from './InkTabBarMixin'; | ||
import TabBarMixin from './TabBarMixin'; | ||
import RefMixin from './RefMixin'; | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import InkTabBarNode from './InkTabBarNode'; | ||
import TabBarTabsNode from './TabBarTabsNode'; | ||
import TabBarRootNode from './TabBarRootNode'; | ||
import SaveRef from './SaveRef'; | ||
|
||
const InkTabBar = createReactClass({ | ||
displayName: 'InkTabBar', | ||
mixins: [RefMixin, TabBarMixin, InkTabBarMixin], | ||
export default class InkTabBar extends React.Component { | ||
render() { | ||
const inkBarNode = this.getInkBarNode(); | ||
const tabs = this.getTabs(); | ||
return this.getRootNode([inkBarNode, tabs]); | ||
}, | ||
}); | ||
return ( | ||
<SaveRef> | ||
{(saveRef, getRef) => ( | ||
<TabBarRootNode saveRef={saveRef} {...this.props}> | ||
<TabBarTabsNode onTabClick={this.props.onTabClick} saveRef={saveRef} {...this.props} /> | ||
<InkTabBarNode saveRef={saveRef} getRef={getRef} {...this.props} /> | ||
</TabBarRootNode> | ||
)} | ||
</SaveRef> | ||
); | ||
} | ||
} | ||
|
||
export default InkTabBar; | ||
InkTabBar.propTypes = { | ||
onTabClick: PropTypes.func, | ||
}; | ||
|
||
InkTabBar.defaultProps = { | ||
onTabClick: () => {}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
export default class SaveRef extends React.Component { | ||
getRef = (name) => { | ||
return this[name]; | ||
} | ||
|
||
saveRef = (name) => { | ||
return (node) => { | ||
if (node) { | ||
this[name] = node; | ||
} | ||
}; | ||
} | ||
|
||
render() { | ||
return this.props.children(this.saveRef, this.getRef); | ||
} | ||
} | ||
|
||
SaveRef.propTypes = { | ||
children: PropTypes.func, | ||
}; | ||
|
||
SaveRef.defaultProps = { | ||
children: () => null, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,23 @@ | ||
import createReactClass from 'create-react-class'; | ||
import InkTabBarMixin from './InkTabBarMixin'; | ||
import ScrollableTabBarMixin from './ScrollableTabBarMixin'; | ||
import TabBarMixin from './TabBarMixin'; | ||
import RefMixin from './RefMixin'; | ||
import React from 'react'; | ||
import InkTabBarNode from './InkTabBarNode'; | ||
import TabBarTabsNode from './TabBarTabsNode'; | ||
import TabBarRootNode from './TabBarRootNode'; | ||
import ScrollableTabBarNode from './ScrollableTabBarNode'; | ||
import SaveRef from './SaveRef'; | ||
|
||
const ScrollableInkTabBar = createReactClass({ | ||
displayName: 'ScrollableInkTabBar', | ||
mixins: [RefMixin, TabBarMixin, InkTabBarMixin, ScrollableTabBarMixin], | ||
export default class ScrollableInkTabBar extends React.Component { | ||
render() { | ||
const inkBarNode = this.getInkBarNode(); | ||
const tabs = this.getTabs(); | ||
const scrollbarNode = this.getScrollBarNode([inkBarNode, tabs]); | ||
return this.getRootNode(scrollbarNode); | ||
}, | ||
}); | ||
|
||
export default ScrollableInkTabBar; | ||
return ( | ||
<SaveRef> | ||
{(saveRef, getRef) => ( | ||
<TabBarRootNode saveRef={saveRef} {...this.props}> | ||
<ScrollableTabBarNode saveRef={saveRef} getRef={getRef} {...this.props}> | ||
<TabBarTabsNode saveRef={saveRef} {...this.props} /> | ||
<InkTabBarNode saveRef={saveRef} getRef={getRef} {...this.props} /> | ||
</ScrollableTabBarNode> | ||
</TabBarRootNode> | ||
)} | ||
</SaveRef> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
import createReactClass from 'create-react-class'; | ||
import ScrollableTabBarMixin from './ScrollableTabBarMixin'; | ||
import TabBarMixin from './TabBarMixin'; | ||
import RefMixin from './RefMixin'; | ||
import React from 'react'; | ||
import ScrollableTabBarNode from './ScrollableTabBarNode'; | ||
import TabBarRootNode from './TabBarRootNode'; | ||
import TabBarTabsNode from './TabBarTabsNode'; | ||
import SaveRef from './SaveRef'; | ||
|
||
const ScrollableTabBar = createReactClass({ | ||
displayName: 'ScrollableTabBar', | ||
mixins: [RefMixin, TabBarMixin, ScrollableTabBarMixin], | ||
export default class ScrollableTabBar extends React.Component { | ||
render() { | ||
const inkBarNode = this.getInkBarNode(); | ||
const tabs = this.getTabs(); | ||
const scrollbarNode = this.getScrollBarNode([inkBarNode, tabs]); | ||
return this.getRootNode(scrollbarNode); | ||
}, | ||
}); | ||
|
||
export default ScrollableTabBar; | ||
return ( | ||
<SaveRef> | ||
{(saveRef, getRef) => ( | ||
<TabBarRootNode saveRef={saveRef} {...this.props}> | ||
<ScrollableTabBarNode saveRef={saveRef} getRef={getRef} {...this.props}> | ||
<TabBarTabsNode saveRef={saveRef} {...this.props} /> | ||
</ScrollableTabBarNode> | ||
</TabBarRootNode> | ||
)} | ||
</SaveRef> | ||
); | ||
} | ||
} |
Oops, something went wrong.