From 2d3c06388ddb5c249d9abe00403fd43965dec374 Mon Sep 17 00:00:00 2001 From: Daniel Heath Date: Tue, 8 Nov 2016 11:55:41 +1100 Subject: [PATCH] Pass through refs and props to all layers of AsyncCreatable. This enables users of AsyncCreatable to hook the Select which is created and/or access it as a ref. Previously there was no way to get at the underlying Select if you used AsyncCreatable. --- src/AsyncCreatable.js | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/src/AsyncCreatable.js b/src/AsyncCreatable.js index 4bd3099b8b..49a8c2b4a7 100644 --- a/src/AsyncCreatable.js +++ b/src/AsyncCreatable.js @@ -7,19 +7,42 @@ const AsyncCreatable = React.createClass({ render () { return ( - {(asyncProps) => ( - - {(creatableProps) => ( - + ); +}; + +const propTypes = { + children: React.PropTypes.func.isRequired, // Child function responsible for creating the inner Select component; (props: Object): PropTypes.element +} + +const defaultProps = { + children: defaultChildren, +} + +Async.propTypes = propTypes; +Async.defaultProps = defaultProps; + module.exports = AsyncCreatable;