score:0

currently (react native 0.66), the documentation states:

there is no difference between using absolutefill vs. absolutefillobject.

score:1

i've tried to print the value of absolutefill and absolutefillobject.
they're no difference. they're the same value.

[log] absolutefill: {"bottom": 0, "left": 0, "position": "absolute", "right": 0, "top": 0}
[log] absolutefillobject: {"bottom": 0, "left": 0, "position": "absolute", "right": 0, "top": 0}

score:4

as of version 0.62, no difference at all according to the official document

in case you are using expo snack like i do, the absolutefill preview on web seems buggy at this time. on a real device, it should be fine.

score:4

i may be late for the party. but there is some difference between absolutefill and absolutefillobject in typescript.

mainly in typescript, the type of:

  • absolutefill is registeredstyle<stylesheet.absolutefillstyle>
  • absolutefillobject is stylesheet.absolutefillstyle
const styles = stylesheet.create({
    container: {
        // must use "absolutefillobject" in typescript
        ...stylesheet.absolutefillobject,
    }
})

for javascript, there is no difference.

score:13

there is no difference between those two. you can see this in stylesheet.js:

 /**
   * a very common pattern is to create overlays with position absolute and zero positioning,
   * so `absolutefill` can be used for convenience and to reduce duplication of these repeated
   * styles.
   */
  absolutefill: (absolutefill: any), // todo: this should be updated after we fix downstream flow sites.

  /**
   * sometimes you may want `absolutefill` but with a couple tweaks - `absolutefillobject` can be
   * used to create a customized entry in a `stylesheet`, e.g.:
   *
   *   const styles = stylesheet.create({
   *     wrapper: {
   *       ...stylesheet.absolutefillobject,
   *       top: 10,
   *       backgroundcolor: 'transparent',
   *     },
   *   });
   */
  absolutefillobject: absolutefill,

enter image description here

score:21

absolutefill is an easy way to set a view to be full screen and absolute positioned. it’s a short cut for:

{
 position: 'absolute',
 top: 0,
 left: 0,
 bottom: 0,
 right: 0

}

use it to extend your other styles like this:

const styles = stylesheet.create({
  container: {
   backgroundcolor: 'red'
   }
});
<view style={[stylesheet.absolutefill, styles.container]} />

absolutefillobject say you want to absolute position your view, but bump it down 20px to offset for the status bar (for example). you can spread stylesheet.absolutefillobject into your style and then override one of it’s values.

const styles = stylesheet.create({
  container: {
    ...stylesheet.absolutefillobject,
   top: 20,
    backgroundcolor: 'red'
  }
});
<view style={styles.container} />

Related Query

More Query from same tag