本文整理汇总了TypeScript中hey-listen.warning函数的典型用法代码示例。如果您正苦于以下问题:TypeScript warning函数的具体用法?TypeScript warning怎么用?TypeScript warning使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了warning函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: warning
createValue: (
init,
key,
props,
{ passiveParent, passiveProps, passiveParentKey }: CreateValueProps = {}
) => {
if (passiveParent) {
if (!nonLayoutValues.has(key)) {
passiveParent.useNativeDriver = props.useNativeDriver = false;
warning(
false,
`useNativeDriver is invalidated on value "${passiveParentKey}", because interpolated value "${key}" can't be animated by the native driver.`
);
}
return {
interpolation: passiveParent.raw.interpolate(passiveProps)
};
} else {
let needsInterpolation = false;
let unit = '';
let initValue = 0;
if (typeof init === 'string') {
unit = getUnit(init);
initValue = parseFloat(init);
if (unitConverters[unit]) {
initValue = convertUnitToPoints(init);
} else {
needsInterpolation = true;
}
} else {
initValue = init;
}
const value: Value = {
raw: new Animated.Value(initValue),
useNativeDriver: nonLayoutValues.has(key)
};
if (needsInterpolation) {
value.interpolation = value.raw.interpolate({
inputRange: [0, 1],
outputRange: [`0${unit}`, `1${unit}`]
});
}
return value;
}
},
开发者ID:Popmotion,项目名称:popmotion,代码行数:50,代码来源:factory.ts
示例2: warning
getProps: (poser, { draggable }, { onDragStart, onDragEnd }) => {
if (!draggable) return {};
warning(
false,
'draggable: true disables useNativeDriver for this component.'
);
const values = poser.get();
const dragX = draggable === true || draggable === 'x';
const dragY = draggable === true || draggable === 'y';
const panResponder = PanResponder.create({
onMoveShouldSetPanResponderCapture: () => true,
onPanResponderMove: Animated.event([
null,
{
dx: dragX ? values.x : null,
dy: dragY ? values.y : null
}
]),
onPanResponderGrant: (e, gestureState) => {
if (dragX) {
values.x.setOffset(values.x._value);
values.x.setValue(0);
}
if (dragY) {
values.y.setOffset(values.y._value);
values.y.setValue(0);
}
if (onDragStart) onDragStart(e, gestureState);
poser.set('dragging', { gestureState });
},
onPanResponderRelease: (e, gestureState) => {
if (onDragEnd) onDragEnd(e, gestureState);
if (dragX) values.x.flattenOffset();
if (dragY) values.y.flattenOffset();
poser.set('dragEnd', { gestureState });
}
});
return panResponder.panHandlers;
}
开发者ID:jamesgeorge007,项目名称:popmotion,代码行数:45,代码来源:index.ts
示例3: warning
const svg = (element: HTMLElement, props: Object): Styler => {
warning(false, 'svg() is deprecated, use styler instead');
return styler(element, props);
};
开发者ID:jamesgeorge007,项目名称:popmotion,代码行数:4,代码来源:index.ts
示例4: makeChildList
const handleTransition = (
{
children: incomingChildren,
preEnterPose,
enterPose,
exitPose,
animateOnMount,
enterAfterExit,
flipMove,
onRest,
...propsForChildren
}: Props,
{
displayedChildren,
finishedLeaving,
hasInitialized,
indexedChildren,
scheduleChildRemoval
}: State
) => {
const targetChildren = makeChildList(incomingChildren as React.ReactNode);
const nextState: Partial<State> = {
displayedChildren: []
};
if (process.env.NODE_ENV !== 'production') {
warning(
!propsForChildren.onPoseComplete,
"<Transition/> (or <PoseGroup/>) doesn't accept onPoseComplete prop."
);
}
const prevKeys = displayedChildren.map(getKey);
const nextKeys = targetChildren.map(getKey);
const hasPropsForChildren = Object.keys(propsForChildren).length !== 0;
const entering = new Set(
nextKeys.filter(
key => finishedLeaving.hasOwnProperty(key) || prevKeys.indexOf(key) === -1
)
);
entering.forEach(key => delete finishedLeaving[key]);
const leaving: string[] = [];
const newlyLeaving: { [key: string]: boolean } = {};
prevKeys.forEach(key => {
if (entering.has(key)) {
return;
}
const isLeaving = finishedLeaving.hasOwnProperty(key);
if (!isLeaving && nextKeys.indexOf(key) !== -1) {
return;
}
leaving.push(key);
if (!isLeaving) {
finishedLeaving[key] = false;
newlyLeaving[key] = true;
}
});
const moving = new Set(
prevKeys.filter((key, i) => {
// if it's not entering or leaving
return !entering.has(key) || leaving.indexOf(key) === -1;
})
);
targetChildren.forEach(child => {
const newChildProps: { [key: string]: any } = {};
if (entering.has(child.key as string)) {
if (hasInitialized || animateOnMount) {
newChildProps.initialPose = preEnterPose;
}
// TODO: Remove _pose and merge with child.props.pose
newChildProps._pose = enterPose;
} else if (moving.has(child.key as string) && flipMove) {
newChildProps._pose = [enterPose, 'flip'];
} else {
newChildProps._pose = enterPose;
}
const newChild = React.cloneElement(child, newChildProps);
indexedChildren[child.key] = newChild;
nextState.displayedChildren.push(
hasPropsForChildren ? prependProps(newChild, propsForChildren) : newChild
);
});
leaving.forEach(key => {
const child = indexedChildren[key];
const newChild = newlyLeaving[key]
? React.cloneElement(child, {
_pose: exitPose,
//.........这里部分代码省略.........
开发者ID:Popmotion,项目名称:popmotion,代码行数:101,代码来源:children.ts
示例5: warning
getProps: (
poser,
{ draggable },
{ onDragStart, onDragEnd, flipMove, measureSelf },
setLayout
) => {
let props: { [key: string]: any } = {};
if (draggable) {
warning(
false,
'draggable: true disables useNativeDriver for this component.'
);
const values = poser.get();
const dragX = draggable === true || draggable === 'x';
const dragY = draggable === true || draggable === 'y';
const panResponder = PanResponder.create({
onMoveShouldSetPanResponderCapture: () => true,
onPanResponderMove: Animated.event([
null,
{
dx: dragX ? values.x : null,
dy: dragY ? values.y : null
}
]),
onPanResponderGrant: (e, gestureState) => {
if (dragX) {
values.x.setOffset(values.x._value);
values.x.setValue(0);
}
if (dragY) {
values.y.setOffset(values.y._value);
values.y.setValue(0);
}
if (onDragStart) onDragStart(e, gestureState);
poser.set('dragging', { gestureState });
},
onPanResponderRelease: (e, gestureState) => {
if (onDragEnd) onDragEnd(e, gestureState);
if (dragX) values.x.flattenOffset();
if (dragY) values.y.flattenOffset();
poser.set('dragEnd', { gestureState });
}
});
props = {
...props,
...panResponder.panHandlers
};
}
if (flipMove || measureSelf) {
props.onLayout = ({ nativeEvent }: LayoutChangeEvent) =>
setLayout(nativeEvent.layout);
}
return props;
}
开发者ID:Popmotion,项目名称:popmotion,代码行数:62,代码来源:posed.ts
注:本文中的hey-listen.warning函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论