Fixing playground editing
Summary: editing numerical values didn't work. this fixes it and cleans up the API of the playground Reviewed By: emilsjolander Differential Revision: D6976128 fbshipit-source-id: 9b1ace9d93ba8e597bdfb4842ed6adcaf8b77fd9
This commit is contained in:
committed by
Facebook Github Bot
parent
9c877a621e
commit
699b1f5012
@@ -15,14 +15,14 @@ import YogaEnumSelect from './YogaEnumSelect';
|
||||
import YogaPositionEditor from './YogaPositionEditor';
|
||||
import {Input} from 'antd';
|
||||
|
||||
type Props<T, S> = {
|
||||
type Props<T> = {
|
||||
property: string,
|
||||
disabled?: boolean,
|
||||
value: string | number,
|
||||
onChange: (value: number) => void,
|
||||
value?: ?T,
|
||||
onChange: (property: string, value: T) => void,
|
||||
};
|
||||
|
||||
export default (props: Props<T, S>) => {
|
||||
export default (props: Props<*>) => {
|
||||
if (YogaEnumSelect.availableProperties.indexOf(props.property) > -1) {
|
||||
return <YogaEnumSelect {...props} />;
|
||||
} else if (
|
||||
@@ -30,6 +30,12 @@ export default (props: Props<T, S>) => {
|
||||
) {
|
||||
return <YogaPositionEditor {...props} />;
|
||||
} else {
|
||||
return <Input type="text" {...props} />;
|
||||
return (
|
||||
<Input
|
||||
type="text"
|
||||
{...props}
|
||||
onChange={e => props.onChange(props.property, e.target.value)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user