Commit Graph

37 Commits

Author SHA1 Message Date
Hedger Wang 36dfd402b2 [madman] Supports `onLayout` for `AdsManagerTouchableHighlight`.
Summary:
Supports `onLayout` for Touchable*` by piping onLayout
through to the native component inside since only native components support
it by default.
2015-09-01 10:22:47 -08:00
Andrei Coman a8f11d7115 [ReactNative] Add TouchableNativeFeedback to OSS 2015-08-26 01:31:52 -08:00
Bill Fisher debca6d24f [ReactNative] Pass events through to touchable handlers
Summary:
We want to be able to access the touch data within our components' event handlers, so we need to thread the event object all the way through to them.
2015-08-21 03:03:32 -07:00
Chace Liang eb402d8c7d [e2e] Fix TouchableHighlight in e2e test 2015-08-11 10:53:50 -08:00
Dorota Kapturkiewicz 59b974eafb [ReactNative] make AdsManager floater and TouchableHighlight accessible 2015-08-10 04:41:09 -08:00
Christopher Chedeau b34892eb80 [ReactNative][BREAKING_CHANGE] Remove cloneElement from TouchableBounce 2015-07-22 17:22:35 -08:00
Christopher Chedeau 725053acfe [Animated][BREAKING_CHANGE] Convert <TouchableOpacity> to Animated
Summary:
Because we don't want to integrate Animated inside of the core of React, we can only pass Animated.Value to styles of <Animated.View>. TouchableOpacity unfortunately used cloneElement. This means that we should have asked every single call site to replace their children to Animated.View. This isn't great.

The other solution is to stop using cloneElement and instead wrap the children inside of an <Animated.View>. This has many advantages:
- We no longer use cloneElement so we're no longer messing up with elements that are not our own.
- Refs are now working correctly for children elements
- No longer need to enforce that there's only one child and that this child is a native element

The downside is that we're introducing a <View> into the hierarchy. Sadly with CSS there is no way to have a View that doesn't affect layout. What we need to do is to remove the inner <View> and transfer all the styles to the TouchableOpacity. It is annoying but fortunately a pretty mechanical process.

I think that having a wrapper is the best solution. I will investigate to see if we can make wrappers on TouchableHighliht and TouchableWithoutFeedback as well.

**Upgrade Path:**

If the child is a View, move the style of the View to TouchableOpacity and remove the View itself.

```
<TouchableOpacity onPress={...}>
  <View style={...}>
    ...
  </View>
</TouchableOpacity>

-->

<TouchableOpacity onPress={...} style={...}>
  ...
</TouchableOpacity>
```

If the child is an Image or Text, on all the examples at Facebook it worked without any change. But it is a great idea to double check them anyway.
2015-07-20 16:44:36 -08:00
Elliot Lynde 4a262e0f2b [React Native][Pokes Dashboard] Fix crash 2015-07-17 17:00:47 -08:00
Nick Lockwood 8708c35702 Restructuring FBReactKit project: Part 2 2015-06-28 11:49:41 -08:00
Alex Kotliarskyi 63b8262843 [ReactNative] Allow TouchableWithoutFeedback override accessible attribute 2015-06-03 16:37:11 -08:00
jmstout 074fa759a6 [Touchable] Add custom delay props to Touchable components
Summary:
@public
This PR adds quite a bit of functionality to the Touchable components, allowing the ms delays of each of the handlers (`onPressIn, onPressOut, onPress, onLongPress`) to be configured.

It adds the following props to `TouchableWithoutFeedback, TouchableOpacity, and TouchableHighlight`:
```javascript
/**
 * Delay in ms, from the release of the touch, before onPress is called.
 */
delayOnPress: React.PropTypes.number,
/**
 * Delay in ms, from the start of the touch, before onPressIn is called.
 */
delayOnPressIn: React.PropTypes.number,
/**
 * Delay in ms, from the release of the touch, before onPressOut is called.
 */
delayOnPressOut: React.PropTypes.number,
/**
 * Delay in ms, from onPressIn, before onLongPress is called.
 */
delayOnLongPress: React.PropTypes.number,
```

`TouchableHighlight` also gets an additional set of props:
```javascript
/**
 * Delay in ms, from the start of the touch, before the highlight is shown.
 */
delayHighlightShow: React.PropTypes.number,
/**
 * Del
...
```

Closes https://github.com/facebook/react-native/pull/1255
Github Author: jmstout <git@jmstout.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-03 12:57:28 -08:00
Changgeng Li 84783dbac4 Add renderSeparator support to ListView 2015-05-26 15:20:29 -08:00
Krzysztof Magiera ff00e1496c [ReactNative] Rename ReactIOS JS module (and relatives) to ReactNative. 2015-05-13 13:24:35 -07:00
Ben Alpert 5e51fac8d5 [react-native] In TouchableOpacity, access .props on element, not component 2015-05-08 08:31:04 -08:00
Eric Vicenti 61bd008ea0 [ReactNative] Fix TouchableOpacity crash when child props are missing 2015-05-07 18:04:19 -08:00
Brent Vatne 0b844feedb [TouchableOpacity] Reset opacity to the inactiveValue rather than always 1.0
Summary:
As per #941 - fixes bug with `TouchabeOpacity` always reseting child opacity to `1.0` after press.

A note about the code: we could probably use a general `getNativeProp(propName, callback)` function rather than `getOpacity` but just used that as it was simpler for this specific PR, perhaps that refactor could be left to another - or maybe there is a way to do this already that I missed.

Before:
![bug](https://cloud.githubusercontent.com/assets/90494/7287207/52d6a686-e907-11e4-8e16-04b2ddd0582c.gif)

After:
![after](https://cloud.githubusercontent.com/assets/90494/7287689/5aca4776-e90c-11e4-8c40-aa6bd3e822d8.gif)

Example code:
```javascript
'use strict';

var React = require('react-native');
var {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  TouchableOpacity,
} = React;

var TestIt = React.createClass({
  render() {
    return (
      <View style={styles.container}>
        <TouchableOpacity activeOpacity={0.3}>
          <View style={styles.searchButton}>
            <Text>
Closes https://github.com/facebook/react-native/pull/977
Github Author: Brent Vatne <brent.vatne@madriska.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-05-06 17:27:12 -08:00
Ben Alpert 8c2f44d640 [react-native] Don't mutate props in TouchableBounce 2015-05-02 10:23:24 -08:00
Spencer Ahrens 9ea0002774 [ReactNative] fixup AnimationExperimental a bit 2015-04-08 14:09:32 -08:00
Christopher Chedeau 2c0e3e97df [ReactNative] Revert D1965911 2015-04-06 08:45:46 -08:00
Spencer Ahrens 620bfb699b [ReactNative] rename Animation to AnimationExperimental with warning docs 2015-04-04 11:20:45 -08:00
Daniele Zannotti a2fa40f684 Added constraint of child type to touchablewithoutfeedback
Summary:
Added constraint of child type to touchablewithoutfeedback to match touchablehighlight (this would have failed silently previously), also added the cloneWithProps as by note of @vjeux
Closes https://github.com/facebook/react-native/pull/517
Github Author: Daniele Zannotti <d.zannotti@me.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-04-04 09:15:21 -08:00
James Ide 6638713d3c [Touchable] Change default `activeOpacity` to 0.2 to match iOS
Summary:
Closes https://github.com/facebook/react-native/pull/296
Github Author: James Ide <ide@jameside.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-03-31 21:09:22 -08:00
Ryan Warren a587525c2d Fixing TouchableOpacity and TouchableHighlight documentation
Summary:
Found a typo in the TouchableOpacity and TouchableHighlight documentation
Closes https://github.com/facebook/react-native/pull/292
Github Author: Ryan Warren <ryan@war.re>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-03-28 15:18:31 -08:00
Basil Hosmer 95deed578c flowified Libraries from Avik 2015-03-25 12:44:28 -08:00
Tadeu Zagallo 57ee9e7dc0 [ReactNative] Use oss TimerMixin 2015-03-24 10:46:05 -08:00
Christopher Chedeau e1ef0328d9 [ReactNative] Expanded license on js files 2015-03-23 13:17:54 -08:00
Amjad Masad f1746ac83e [react-packager] change all but one `ix` to `require` 2015-03-20 15:26:58 -08:00
James Ide f002fda275 [TouchableHighlight] Preserve underlay style when restoring inactive props
Summary:
If you give a TouchableHighlight component some styling (e.g. a background color) with the `underlayStyle` prop, the style is wiped away after touching the component. This diff restores the `underlayStyle`.

Closes https://github.com/facebook/react-native/pull/129
Github Author: James Ide <ide@jameside.com>

Test Plan:
 Create a TouchableHighlight that receives `underlayStyle={{style:
'blue'}}`. It initially has a blue background. Touch it and let go. See the blue background now comes back as expected.
2015-03-18 11:56:24 -08:00
Christopher Chedeau f377849c73 [ReactNative] Clean up Touchable PropTypes
Summary:
Summary:
Instead of having a separate TouchablePropTypes, put those in TouchableWithoutFeedback and have the other ones use ...TouchableWithoutFeedback.propTypes. This makes it work with the docs parsing.

Closes https://github.com/facebook/react-native/pull/159
Github Author: Christopher Chedeau <vjeux@fb.com>

Test Plan:
Run the website, make sure all the touchable components have the right prop types

CC:

Task ID: #
2015-03-17 16:46:14 -08:00
Spencer Ahrens b396de3cc8 [ReactNative] s/RK/RCT in OSS 2015-03-17 02:48:57 -08:00
Alex Akers fb475dd0c4 [React Native] Add preliminary animation API 2015-03-10 14:19:38 -08:00
Christopher Chedeau f61e4184a8 [ReactNative] s/View.stylePropType/View.propTypes.style/ 2015-03-09 09:49:27 -08:00
Christopher Chedeau d8e83c882e [ReactNative] Move around and reformat comments for the documentation 2015-03-09 09:49:24 -08:00
Ben Alpert b335f88efd [React Native] Update core modules for React 0.13 2015-03-06 17:12:53 -08:00
Christopher Chedeau 33290fb1e2 [ReactNative] Replace all the call sites of copyProperties by Object.assign 2015-03-01 16:09:11 -08:00
James Ide 337329451d [Touch] Suite of touchable events on TouchableHighlight/Opacity
Summary:
The following props are now supported on TouchableHighlight/Opacity components:

 - onPress (was there before)
 - onPressIn
 - onPressOut
 - onLongPress

There is a `TouchableFeedbackPropType` that is shared amongst the Touchable family for consistency.

Added UIExplorer example to demonstrate and test.

Fixes #101.
Closes https://github.com/facebook/react-native/pull/102
Github Author: James Ide <ide@jameside.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-02-26 10:30:31 -08:00
Spencer Ahrens efae175a8e [react-packager][streamline oss] Move open sourced JS source to react-native-github 2015-02-19 21:25:11 -08:00